home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Text⁄Files
/
SFGetFolder
/
Read Me First (Please)
< prev
next >
Wrap
Text File
|
1992-06-06
|
3KB
|
60 lines
Introduction
The Think C code in this archive implements a custom Standard File Dialog
that allows users to select folders in which to save or locate files.
All code and resources you need to use StandardGetFolder are included. Also
included is a small sample program (in Think C) demonstrating the use of
StandardGetFolder.
Requirements
Due to the fact the StandardGetFolder makes use of the CustomGetFile toolbox
function and FSSpec records, it will only work under Sytem 7.0 or later.
Using StandardGetFolder
First, you need include the ANSI and MacTraps libraries in your project. You
also need to include the resources (one DLOG and one DITL) from the file
'GetFolder.π' in your project resource file.
StandardGetFolder works pretty much like StandardGetFile. Here's the
function prototype:
void StandardGetFolder ( Point where,
Str255 message,
StandardFileReply *mySFReply);
You pass it the point where you want the dialog displayed, the prompt you
want it to display above the file/folder list, and a pointer to an Standard
File Reply record. Upon return, the sfFile field of the SFReply record (an
FSSpec record) will contain the volume reference number and directory ID
that reference the directory the user chose. You simply need to add a file
name to the FSSpec record. See the sample program 'sample.c' to see how
this works.
Acknowledgements
Portions of this code were originally provided by Paul Forrester
(paulf@apple.com) to the think-c internet mailing list in response to my
my question on how to do exactly what this code does. I've added a
couple of features, such as the ability to handle aliased folders and
the programmer definable prompt. I also cleaned and tightened up the code,
stomped a couple of bugs, and packaged it up neatly. Bunches of work,
but I learned A LOT about Standard File, the File Manager, the Dialog
Manager, and the Alias Manager. I tried to include in the comments some
of the neat stuff I discovered in my hours of pouring over Inside Mac.
Hope you find it educational as well as useful.
Bug Reports, Kudos, etc.
If you find a bug, have a better way to do something than the way I did it,
or just appreciate the code, feel free to drop me a note at
kkirksey1@aol.com.
Ken